<?php

Route::domain(env('MINIAPP_DOMAIN'))
    ->middleware(['miniapp'])
    ->group(function ($routes) {

        //首页
        $routes->get('/', 'HomeController@index');
        $routes->get('/advice/index', 'HomeController@advice_list');
        $routes->get('/advice/detail', 'HomeController@advice_detail');
        $routes->post('/verify_mobile', 'HomeController@verify_mobile');  //验证手机号码
        $routes->post('/bind_phone', 'HomeController@bind_phone');
        $routes->post('/add_advice', 'HomeController@add_advice'); //新增意见反馈/投诉

        $routes->post('/supplier/apply', 'HomeController@supplier_apply');//商家入住
        $routes->get('/check_guide', 'HomeController@check_guide');
        $routes->get('/send_tpl_msg', 'HomeController@send_tpl_msg');
        $routes->get('/hotwords', 'HomeController@hotwords'); //热门词
        $routes->get('/category/{id}', 'ContentController@category');

        //园区数据
        $routes->get("/park/options", "HomeController@park_options"); //园区列表

        // 店铺
        $routes->group(['prefix' => 'shop'], function ($routes) {
            $routes->get('/index', 'ShopController@index');
            $routes->get('/park_list', 'ShopController@park_list');
            $routes->get('/search', 'ShopController@search');
            $routes->get('detail/{id}', 'ShopController@detail');
        });

        // 会员中心
        $routes->get('/member/detail', 'MemberController@detail');
        $routes->get('/member/combo', 'MemberController@combo');
        $routes->get('/member/init', 'MemberController@init');
        $routes->get('/member/deliver_init', 'MemberController@deliver_init');//配送列表初始化数据
        $routes->post('/member/update_tag', 'MemberController@update_tag');//配置标签
        $routes->post('/member/update_park', 'MemberController@update_park');//更改园区
        $routes->post('/member/upload', 'MemberController@upload');//上传图片

        $routes->get('/address/list', 'MemberController@address_list');//地址列表
        $routes->get('/address/detail', 'MemberController@address');//列表详情
        $routes->get('/address/my', 'MemberController@address_my');//我的地址
        $routes->post('/address/delete', 'MemberController@del_address');//删除地址
        $routes->post('/address/edit', 'MemberController@edit_address');//新增/编辑地址
        $routes->post('/address/set_default', 'MemberController@address_set_default');//设置默认值

        //商户
        $routes->get('/supllier/detail', 'HomeController@supllier_detail');//商户信息


        $routes->post('/member/update', 'MemberController@update');//更新数据
        $routes->post('/member/update_field', 'MemberController@update_field');//更新数据

        // 订单中心
        $routes->post('/order/create', 'OrderController@create');//通用订单生成
        $routes->post('/order/cancel', 'OrderController@cancel');//取消订单
        $routes->get('/order/pay_param', 'OrderController@pay_param');//支付参数
        $routes->get('/order/list', 'OrderController@index');//订单列表
        $routes->get('/order/deliver_list', 'OrderController@deliver_list');//配送-订单列表
        $routes->get('/order/detail', 'OrderController@detail');//订单详情
        $routes->get('/order/deliver_stat', 'OrderController@deliver_stat');//订单配送统计
        $routes->get('/order/deliver_timeList', 'OrderController@delivery_time_list');//订单配送统计
        $routes->post('/order/confirm_deliver', 'OrderController@confirm_deliver');//确认分拣
        $routes->post('/order/printer_init_data', 'OrderController@printer_init_data');//订单打印初始化
        $routes->post('/order/printer', 'OrderController@printer');//订单打印

        //产品中心
        $routes->get('/product/category/list', 'ProductController@cate_list');  //产品列表
        $routes->get('/menu/product/list', 'ProductController@menu_productList');  //菜单产品
        $routes->get('/combo/product/list', 'ProductController@combo_productList');  //套餐产品
        $routes->get('/product/detail', 'ProductController@detail');  //商品详情
        $routes->get('/goods/search', 'ProductController@index');  //产品列表

        //菜单中心

        //文件
        $routes->any('/file/upload', 'FileController@upload');  //上传
        $routes->get('/mini/share_list', 'HomeController@mini_share_list');

        // 优惠券
        $routes->group(['prefix' => 'coupon'], function ($routes) {
            $routes->get('/list', 'CouponController@index');
            $routes->get('/can_use', 'CouponController@mapping');
            $routes->get('/mapping/list', 'CouponController@mapping_list');
            $routes->post('/gain/{id}', 'CouponController@gain');
        });


    });

// 可登陆或不登录
Route::domain(env('MINIAPP_DOMAIN'))
    ->middleware(['miniappno'])
    ->group(function ($routes) {
        $routes->get('/upload', 'HomeController@upload'); // 上传文件
        $routes->get('/mini/share_list', 'HomeController@mini_share_list');

        $routes->post('/create_qrcode', 'HomeController@create_qr');
        $routes->get('/test', 'TestController@test');
        $routes->get('/menu/list', 'DailyMenuController@index');  //菜单列表-有效

        $routes->group(['prefix' => 'console/shop'], function ($routes) {
            $routes->post('/login', 'ShopConsoleController@login');  //登陆
        });

    });


//商家端
Route::domain(env('MINIAPP_DOMAIN'))
    ->middleware(['shop'])
    ->group(function ($routes) {
        $routes->group(['prefix' => 'console/shop'], function ($routes) {
            $routes->get('order_list', 'ShopConsoleController@order_list');  //订单列表
            $routes->post('printer_init_data', 'ShopConsoleController@printer_init_data');  //打印数据
            $routes->post('printer', 'ShopConsoleController@printer');  //打印
            $routes->post('confirm', 'ShopConsoleController@confirm_deliver');  //确认已出餐
            $routes->post('accept', 'ShopConsoleController@accept');  //接单
            $routes->get('stat', 'ShopConsoleController@stat');  //店铺统计
        });
    });

//退出系统
Route::post('/login', 'LoginController@index');
Route::get('/config/detail', 'HomeController@config');
Route::get('/captcha', 'LoginController@captcha');

Route::get('/get_banner', 'HomeController@get_banner');  //获取banner值
Route::post('/notify/wx_notify', 'HomeController@wx_notify'); //支付异步通知

// 文章
Route::get('/content/list', 'ContentController@index');
Route::get('/content/detail', 'ContentController@detail');

// 订单打印
Route::get('/cron_printer_task', 'CronController@printer_task');
Route::get('/cron_print_order', 'CronController@print_order');
Route::get('/cron_auto_accept', 'CronController@auto_accept');//自动接单

Route::get('/cron_cancel_order', 'CronController@cancel_order');
//Route::get('/export', 'OrderController@export_order');
Route::get('/async_data', 'CronController@async_data');


